from selenium import webdriver
import time
# 创建对象
try:
    driver=webdriver.Chrome()
    driver.maximize_window()
    driver.get("https://www.baidu.com")
    time.sleep(2)
    # 打印网页源码
    print(driver.page_source)
except Exception as e:
    print(f"Error:{e}")